package com.quickstart.web;

import com.quickstart.entity.UserEntity;
import com.quickstart.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;

/**
 * @author:wesley
 */
@Controller
@RequestMapping(value = "/web/user")
public class UserWebController {

    @Autowired
    private UserService userService;


    @RequestMapping(value = "/list")
    public String toUserList(HttpServletRequest request,String menuId){
        request.setAttribute("menuId",menuId);
        return "user/list";
    }


    @RequestMapping(value = "/add")
    public String toAdd(Integer id,HttpServletRequest request){
        UserEntity userEntity = userService.getUserById(id);
        request.setAttribute("user",userEntity);
        return "user/add";
    }


}
